# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=lua-inspect
_rockname=inspect
_pkgname=inspect.lua
pkgver=3.1.3
pkgrel=0
pkgdesc="Human-readable representation of Lua tables"
url="https://github.com/kikito/inspect.lua"
arch="noarch"
license="MIT"
depends="lua"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kikito/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	install -Dm644 "$builddir"/inspect.lua \
		"$pkgdir"/usr/share/lua/common/inspect.lua
	install -Dm644 README.md \
		"$pkgdir"/usr/share/doc/$pkgname/README.md

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="
bc0e93d4c56ce8e5a76d9b19b1376493d2be9e1280cabd8f1251729b2286f711030a13283771ec26e2107131c081d44435dbec70b172313b2493a6e346a1a6fb  lua-inspect-3.1.3.tar.gz
"
